Rumpus 1.3 User's Guide

User Account Management Using AppleEvents

If you are developing an automated system for managing user accounts, a third party account management program, or would like to control user accounts through AppleScript, you can use AppleEvents to manipulate the Rumpus user database. The AppleEvents used to manage user accounts are, for the most part, straightforward, and the AppleScript samples below should make the process clear.

Note that all Rumpus user account management AppleEvents are of the class "FTPA". This class supports 5 different actions, described below, with the Event IDs: "RUDB", "GETL", "GETD", "ADDU" and "DELU".

Reloading The User Database

One method of manipulating Rumpus user accounts is to make changes directly to the Rumpus User Database file. This file is a simple tabs-delimitted text file where records are separated by carriage returns and are sorted alphabetically by username. Records in the database file have the following format:
    Username <TAB> Password <TAB> DropFolder <TAB> PrivFlags <TAB> MaxFolderSize <CR>
The username, password and drop folder fields are self explanatory. Note that the drop folder entry should be "ROOT" when the user is not assigned a drop folder and should be placed in the FTP root when logged in. The "MaxFolderSize" should be zero ("0") when the user is permitted unlimitted hard disk space. Otherwise, the value is simply the number of megabytes the user is allowed to use in their drop folder.

The "PrivFlags" field represents the user's access privileges. Each character of the field represents 1 privilege, with a value of "Y" representing "permission enabled" and "N" meaning that the user does not have the particular permission. The privileges are, in order:

Restrict To DropFolder
Permit File Downloads
Permit File Uploads
Permit File Deletes
Permit Folder Creation
Permit Folder Deletes
Permit Login
Permit Directory Listings

If you are going to directly manipulate the Rumpus User Database file, we strongly urge you to create several user accounts using the built-in user interface, save the accounts, and open the User Database file in a text editor. You can then review the file directly, which should answer any questions you might have.

Once you have made changes to the User Database file, Rumpus can be forced to reload the updates without quitting and re-launching. This is done with the "Reload User DataBase" AppleEvent (or "RUDB"). For example, the following AppleScript, when run, will cause Rumpus to reload the database from the Rumpus User Database file on disk, causing any updates in the file to take effect immediately:

    tell application "Rumpus 1.3"
        <<event FTPARUDB>>    end tell
Important Note! The "Reload" event only needs to be sent when you have directly manipulated the Rumpus User Database file. When issuing the higher-level AppleEvents listed below that add and delete user accounts, changes automatically and immediately go into effect, without the need to force a reload.

Listing Defined User Accounts

You can issue an AppleEvent ("GETL") to "GET a List" of currently defined users. The following AppleScript will retrieve this list from Rumpus, and the results will be displayed in the "Results" Apple ScriptEditor window:
    tell application "Rumpus 1.3"
        <<event FTPAGETL>>    end tell

Viewing User Detail Records

The complete record defining each user account is also available, using the "GET Detail" ("GETD") AppleEvent. The record comes back as plain text, wih each field labeled and delimitted by returns. For more information on the record specification, see "Adding Users" below.

When requesting user detail, you must specify the username of the account being requested. For example, to retrieve the complete account information for the user "John", use the AppleScript:

    tell application "Rumpus 1.3"
        <<event FTPAGETD>> "John"
    end tell
This script might then return:
    Username: John
    Password: moof
    DropFolder: ROOT
    MaxFolderSize: 0
    RestrictToDropFolder: NO
    PermitLogin: YES
    PermitSeeFiles: YES
    PermitDownload: YES
    PermitUpload: YES
    PermitDelete: YES
    PermitCreateFolders: NO
    PermitDeleteFolders: NO

Adding Users

User accounts can be added using the "ADD User" ("ADDU") AppleEvent. The "Add User" event can also be used to modify/update an existing account, and will automatically do so if the username specified already exists in the user database.

The account information is sent as a single text string, with each field labeled and delimitted by returns. Each field is made up of the field name, a colon, and the field value.

The fields "Username" and "Password" should be fairly obvious. The field values are plain text.

The "DropFolder" field is the plain text path to the user's assigned drop folder. If the user should be placed in the FTP root folder when logging in, use a value of "ROOT". The "MaxFolderSize" represents the maximum amount of hard disk space, in megabytes, the user can store in their drop folder.

The rest of the fields specify permissions. The possible values are "YES", which means "enable the permission" or "NO", which means the user does not have the permission specified. The permission fields are:

PERMISSION FIELD NAMEALLOW USER TO...
RestrictToDropFolderclimb out of drop folder?
PermitLoginlog in?
PermitSeeFilessee directory listings?
PermitDownloaddownload files?
PermitUploadupload files?
PermitDeletedelete files?
PermitCreateFolderscreate folders?
PermitDeleteFoldersdelete folders?

When defining a user, you will need to build a text string that includes each of the defined fields, and then send the string to Rumpus. For example, the following AppleScript will create a user account for the user "John":

    tell application "Rumpus 1.3"
        set UserRecord to
            "Username: John" & return & 
            "Password: moof" & return & 
            "DropFolder: ROOT" & return & 
            "MaxFolderSize: 0" & return & 
            "RestrictToDropFolder: NO" & return & 
            "PermitLogin: YES" & return & 
            "PermitSeeFiles: NO" & return & 
            "PermitDownload: YES" & return & 
            "PermitUpload: NO" & return & 
            "PermitDelete: YES" & return & 
            "PermitCreateFolders: NO" & return & 
            "PermitDeleteFolders: YES" & return
        <<event FTPAADDU>> UserRecord
    end tell

Deleting Users

User accounts can also be removed, using the "DELete User" ("DELU") AppleEvent. When deleting a user account, you need to specify only the username of the account to be deleted. Rumpus will completely remove the record from the database. In AppleScript, deleting a user named "John" looks like this:
    tell application "Rumpus 1.3"
        <<event FTPADELU>> "John"
    end tell


[ Previous | Table Of Contents | Next ]

Copyright © 1997-9 Maxum Development Corporation
http://www.maxum.com/